//
// Created by hjie on 23-7-23.
//

#pragma once
#include <string>
#include <cstring>
#include <vector>
#include <unistd.h>
#include <errno.h>

class AACFrame
{
public:
    AACFrame();
    bool AdtsFixedHeader(const uint8_t * buffer, int length, int & index);
    bool AdtsVariableHeader(const uint8_t * buffer, int length, int & index);
    void DumpFixedHeader();
    void DumpVariableHeader();
public:
    // fixed
    uint16_t m_sync_word;
    uint8_t  m_id;
    uint8_t  m_layer;
    uint8_t  m_protection_absent;
    uint8_t  m_profile;
    uint8_t  m_sampling_frequency_index;
    uint8_t  m_private_bit;
    uint8_t  m_channel_configuration;
    uint8_t  m_origin_copy;
    uint8_t  m_home;
    // variable
    uint8_t  m_copyright_identification_bit;
    uint8_t  m_copyright_identification_start;
    uint16_t m_aac_frame_length;
    uint16_t m_adts_buffer_fullness;
    uint8_t  m_number_of_raw_data_blocks_in_frame;
    // es length and data content
    int m_es_length;
    std::vector<uint8_t> m_es_data;
};

